package com.ihakul.logger;

import android.util.Log;

import java.util.logging.Level;
import java.util.logging.LogRecord;

/**
 * Lower {@link Level}(FINE <==> ALL) Handler for Android
 *
 * @author Aaron
 * @version 2.1
 * Create at 2019/7/19
 */
class LowHandler {

    private static final int LEVEL=Level.INFO.intValue();
    private final int FINE; // DEBUG

    /*package */ LowHandler(Level level){
        FINE=level.intValue();
    }

    boolean isLoggable(LogRecord lr){
        return lr.getLevel().intValue()<LEVEL;
    }

    void publish(LogRecord lr){
        Log.println((lr.getLevel().intValue() == FINE) ? Log.DEBUG : Log.VERBOSE,
                lr.getLoggerName(),
                lr.getMessage());
    }
}
